{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "11fb0649-9657-4234-96f8-483c3bd83985",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics import classifcation_report\n",
    "model=DecisionTreeClassifier(criterion='entropy',max_depth=5)\n",
    "model.fix(x_train,y_train)\n",
    "pred=model.predict(x_test)\n",
    "re=classification_report(y_test,pred)\n",
    "print('模型评估报告：')\n",
    "print(re)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0eb855d1-8c88-4ecb-a41c-fd00704c132d",
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib.colors import ListedColormap\n",
    "N,M=500,500\n",
    "t1=np.linspace(140,195,N)\n",
    "t2=np.linspace(30,90,M)\n",
    "x1,x2=np.meshgrid(t1,t2)\n",
    "x_new=np.stack((x1.flat,x2.flat),axis=1)\n",
    "y_predict=model.predict(x_new)\n",
    "y_hat=y_predict.reshape(x1.shape)\n",
    "iris_cmap=ListedColormap([\"#ACC6C0\",\"#FF8080\"])\n",
    "plt.pcolormesh(x1,x2,y_hat,cmap=iris_cmap)\n",
    "plt.scatter(x[y==0,0],x[y==0,1],c='r',s=60,marker='o')\n",
    "plt.scatter(x[y==1,0],x[y==1,1],c='b',s=60,marker='^')\n",
    "plt.rcParams['font.sans-serif']='Simhei'\n",
    "plt.xlabel('身高/cm')\n",
    "plt.ylabel('体重/kg')\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
